VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form dlgConsulta 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Dialog "
   ClientHeight    =   4035
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   5805
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4035
   ScaleWidth      =   5805
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton OKButton 
      Caption         =   "Aceptar"
      Height          =   375
      Left            =   4560
      TabIndex        =   2
      Top             =   480
      Width           =   1215
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "Cancelar"
      Height          =   375
      Left            =   4560
      TabIndex        =   1
      Top             =   960
      Width           =   1215
   End
   Begin MSFlexGridLib.MSFlexGrid lvConsulta 
      Height          =   3855
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4335
      _ExtentX        =   7646
      _ExtentY        =   6800
      _Version        =   393216
      FixedCols       =   0
      Redraw          =   -1  'True
      SelectionMode   =   1
   End
End
Attribute VB_Name = "dlgConsulta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim stringitem As String
Public consulta As String
Public Codigo As Integer

Private Sub cmdSalir_Click()
Unload Me
End Sub



Private Sub Form_Load()
ConsultaSql consulta
If Not rs.RecordCount = 0 Then
lvConsulta.Cols = 2
lvConsulta.ColWidth(0) = 700 'columna item
lvConsulta.ColWidth(1) = 3500 ' columna prod
lvConsulta.TextMatrix(0, 0) = "Codigo"
lvConsulta.ColAlignment(0) = flexAlignRightCenter
lvConsulta.TextMatrix(0, 1) = "Descripcion"

lvConsulta.Rows = 1

rs.MoveFirst
While (Not rs.EOF)
    stringitem = Str(rs.Fields(0)) & Chr(9) & rs.Fields(1)
    lvConsulta.AddItem stringitem
    
    rs.MoveNext
    
Wend

End If

End Sub

Public Sub set_titulo(titulo As String)
Me.Caption = "Consulta de " & titulo
End Sub



Private Sub lvConsulta_DblClick()
Codigo = lvConsulta.TextMatrix(lvConsulta.Row, 0)
Unload Me
End Sub

Private Sub OKButton_Click()
Codigo = lvConsulta.TextMatrix(lvConsulta.Row, 0)
Unload Me
End Sub

Private Sub CancelButton_Click()
Codigo = 0
Unload Me
End Sub

